package Review2;

import java.lang.reflect.Array;

public class Test03 {

	public static void main(String[] args) {

	}
	public static boolean hasNum(int[][] matrix,int num){
		if(matrix==null||matrix.length==0){
			return false;
		}
		int rows = matrix.length;
		int columns = matrix[0].length;
		int i = 0;
		int j = columns-1;
		while(i<rows&&j>=0){
			if(num==matrix[i][j]){
				return true;
			}
			else if(num>matrix[i][j]){
				i++;
			}
			else{
				j--;
			}
		}
		return false;
		
		
	}

}
